<?php $base_path = Yii::app()->baseUrl; ?>
<div class="block small left">

    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        <h2>Tìm kiếm</h2>	
    </div>
    <div class="block_content">
        <form action="" method="GET">
            <p>                
                <input type="text" class="text" name="kw" value="<?php echo str2str($_GET['kw']); ?>" />
            </p>
            <p>jobs title, company name, location name</p>
            <p><input type="submit" class="submit small" value="Tìm kiếm" /></p>
        </form>

    </div>
    <div class="bendl"></div>
    <div class="bendr"></div>

</div>

<div class="block small right">

    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>

        <h2>Thống kê</h2>
    </div>
    <div class="block_content">
        <p>Tìm thấy: <strong><?php echo number_format($item_count, 0, '', '.'); ?></strong> người dùng</p>
    </div>

    <div class="bendl"></div>
    <div class="bendr"></div>

</div>

<div class="block">

    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        <h2>Danh sách thành viên</h2>
        <ul>
            <li><a href="<?php echo $this->createUrl('people/add') ?>">Add new</a></li>
        </ul>
    </div>
    <div class="block_content">
        <?php echo showMessage(); ?>
        <form action="" method="post">
            <table cellpadding="0" cellspacing="0" width="100%" class="sortable">
                <thead>
                    <tr>                        
                        <th>Email</th>
                        <th>Created</th>
                        <th>Roles</th>
                        <th>Status</th>
                        <td>&nbsp;</td>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    if (!empty($data['listItem'])) {
                        foreach ($data['listItem'] as $item) {
                            $listRole = '';
                            if ($item->role != '') {
                                $arr = explode(',', trim($item->role));
                                foreach($arr as $role_id) {
                                    $listRole .= $data['role'][$role_id] . ', ';
                                }
                                $listRole = rtrim(rtrim($listRole), ',');
                            }
                            ?>
                            <tr>                                
                                <td><?php echo $item->email; ?></td>
                                <td><?php echo date('Y/m/d H:i:s', $item->register_time); ?></td>
                                <td><?php echo $listRole; ?></td>
                                <td><?php echo $item->status == 1 ? 'Active' : 'Unactive'; ?></td>
                                <td class="delete">
                                    <a href="<?php echo $this->createUrl('people/edit', array('uid' => $item->id)) ?>">Edit</a>
<!--                                    <a href="<?php echo $this->createUrl('job/delete', array('id' => $item->id)) ?>" onclick="return confirm('Bạn chắc chắc chắn muốn xóa job đã chọn');">Delete</a>-->
                                </td>
                            </tr>
                            <?php
                        }
                    } else {
                        ?>
                        <tr><td colspan="5">No data</td></tr>
                        <?php
                    }
                    ?>                    
                </tbody>
            </table>            

            <?php
            if (!empty($data['listItem'])) {
                echo '<div class="pagination right">';
                drawCLinkPager($this, $pages, $item_count, $page_size);
                echo '</div>';
            }
            ?>
        </form>

    </div>
    <div class="bendl"></div>
    <div class="bendr"></div>
</div>